package com.yqy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 测试RestFul增删改查
 */
@Controller
public class TestRestController {
    @GetMapping("/user")
    public String getAllUser(){
        System.out.println("查询到的所有用户信息：/user → GET");
        return "success";
    }

    @GetMapping("/user/{id}")
    public String getUserById(@PathVariable("id") Integer id){
        System.out.println("通过Id查询到的用户信息：/user/"+id+" → DELETE");
        return "success";
    }

    @PostMapping("/user")
    public String insertUser(){
        System.out.println("添加用户信息：/user → POST");
        return "success";
    }

    @PutMapping("/user")
    public String updateUser(){
        System.out.println("修改用户信息：/user → PUT");
        return "success";
    }

    @DeleteMapping("/user/{id}")
    public String deleteUserByid(@PathVariable("id") Integer id){
        System.out.println("通过Id删除用户信息：/user/"+id+" → DELETE");
        return "success";
    }
}
